#ifndef VIB_MODEL_FILE_LOADER_H
#define VIB_MODEL_FILE_LOADER_H

#include "ModelFileManager.h"
#include "../util/Tokenizer.h"
namespace geom
{
	class PolyObject;
	class PolyModel;
	class PolyMesh;
	class MeshPoint;
}

namespace dataengine
{
	/** Loads an object from a file in ViBos format */
	class VibModelFileManager : public ModelFileManager
	{
		protected:
			/** Reads a model from the file */
			void readModel(geom::PolyModel & model);
			/** Reads a mesh from the file */
			void readMesh(geom::PolyMesh & mesh);
			/** Reads a point from the file */
			void readPoint(geom::MeshPoint & point);
			/** Tokenizer to use when parsing the file */
			auto_ptr< util::Tokenizer > m_tok;

		public:
			/** Constructor 
			  @param filename File to load the object from */
			VibModelFileManager(string filename) throw():ModelFileManager(filename){}
			/** Destructor */
			~VibModelFileManager() throw(){}

			/** Checks if the object can be loaded with this class */
			bool canLoadFile() throw();
			/** Loads the object from the file */
			auto_ptr< geom::PolyObject > loadFile() throw (DataException);
			/** Saves a PolyObject to the file 
			  @param os PolyObject to save to the file */
			void saveToFile(const geom::PolyObject &os) throw (DataException);
	};
}
#endif
